import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-10-19
 * Time: 21:03
 */
@WebServlet("/parameter2")
public class ParameterServlet2 extends HttpServlet {
            // 预期让客户端发送一个 POST 请求. 同时使用 form 格式的数据, 在 body 中把数据传递过来.
            // body 形如:
            // username=zhangsan&password=123
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String user_name=req.getParameter("username");
        String pass_word=req.getParameter("password");
        System.out.println("username :"+ user_name);
        System.out.println("password :"+ pass_word);
        resp.getWriter().write("okk");
    }
}
